import java.util.*;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int T = in.nextInt();
        int i = 0;
        //控制输入组数
        for(int a = 0;a<T;a++) {
            int n = in.nextInt();
            int k = in.nextInt();
            int[] arr = new int[2*n];
            //输入数组
            for(i = 0;i<2*n;i++) {
                arr[i] = in.nextInt();
            }
            int[] temp = new int[arr.length];
            //控制洗牌次数
            for(int j = 0;j<k;j++) {
                int left = 0,right = (2*n)/2;
                int m = 0;
                //一次洗牌
                while(right<arr.length) {
                    temp[m++] = arr[left++];
                    temp[m++] = arr[right++];
                }
                int[] tem = arr;
                arr = temp;
                temp = tem;
            }
            for(int j = 0;j<arr.length;j++) {
                System.out.print(arr[j] + " ");
            }
            System.out.printf("\n");
        }
    }
}